//
//  FDUserTool.m
//  FD
//
//  Created by xiaofang wang on 2018/12/3.
//  Copyright © 2018年 ZhiYuan Network. All rights reserved.
//

#import "FDUserTool.h"
static NSString *Account = @"name";
static NSString *Password = @"password";

@implementation FDUserTool

/**保存用户信息*/
+ (void)fd_saveUserInfo:(NSDictionary *)dic {
    //account
    NSString *account = dic[Account];
    
    //pwd
    NSString *pwd = dic[Password];
    
    //NSDictionary *parDic = @{@"name":phone,@"password":pwd};
    
    [[self udf] setValue:account forKey:Account];
    [[self udf] setValue:pwd forKey:Password];
}

/**退出登录后,清空用户信息*/
+ (void)fd_clearUserInfo {
    [[self udf] removeObjectForKey:Account];
    [[self udf] removeObjectForKey:Password];
}

/**取出保存的用户信息*/
+ (NSString *)fd_account {
    
    NSString *acc =  [[self udf] valueForKey:Account];
    FDLog(@"账号是:%@",acc);
    return acc;
}

/**取出保存的密码*/
+ (NSString *)fd_password {
    NSString *pwd = [[self udf] valueForKey:Password];
    FDLog(@"密码是:%@",pwd);
    return pwd;
}


+ (NSUserDefaults *)udf{
    return [NSUserDefaults standardUserDefaults];
}

@end
